Improvements based on Sam Keen's recent article#53
Improvements based on Sam Keen's recent article#53harrymunro wants to merge 15 commits intosnarktank:mainfrom
Conversation
Add comprehensive security guide covering: - Mandatory safeguards for autonomous agent runs - Pre-flight security checklist with dangerous env vars - Emergency stop procedures - Docker sandboxing example
Add planning skill with 5 mandatory question rounds to force deep requirements exploration before PRD creation. Includes completion gate that requires all rounds to be completed.
Greptile OverviewGreptile SummaryThis PR significantly improves Ralph's production-readiness by adding comprehensive security, cost tracking, and quality control mechanisms. Key Improvements:
Impact: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant ralph.sh
participant Security Check
participant Circuit Breaker
participant AI Agent
participant Quality Gates
participant prd.json
User->>ralph.sh: Start Ralph
ralph.sh->>Security Check: Check environment variables
alt Credentials Detected
Security Check-->>User: Warn about AWS_ACCESS_KEY_ID, DATABASE_URL
User->>Security Check: Confirm or abort
end
Security Check->>ralph.sh: Continue
loop For each iteration (up to MAX_ITERATIONS)
ralph.sh->>prd.json: Get next incomplete story
ralph.sh->>Circuit Breaker: Check story attempts
alt Max attempts reached
Circuit Breaker->>prd.json: Mark story as skipped
Circuit Breaker->>ralph.sh: Skip to next story
else Attempts remaining
Circuit Breaker->>ralph.sh: Increment attempt counter
ralph.sh->>AI Agent: Spawn fresh instance (Amp or Claude)
AI Agent->>AI Agent: Read prd.json, progress.txt
AI Agent->>AI Agent: Implement story
AI Agent->>Quality Gates: Run typecheck, lint, tests
alt Quality gates pass
Quality Gates->>AI Agent: All checks passed
AI Agent->>AI Agent: Commit changes
AI Agent->>prd.json: Mark story passes: true
AI Agent->>AI Agent: Append to progress.txt
AI Agent-->>ralph.sh: Output COMPLETE signal (if all done)
else Quality gates fail
Quality Gates->>AI Agent: Checks failed
AI Agent->>AI Agent: Leave story incomplete
end
ralph.sh->>ralph.sh: Check for COMPLETE signal
alt COMPLETE claimed
ralph.sh->>prd.json: Verify all stories passes: true
alt Verification passes
ralph.sh-->>User: All tasks completed
else Verification fails
ralph.sh->>ralph.sh: Continue iteration
end
end
end
end
|
| LAST_STORY=$(cat "$LAST_STORY_FILE" 2>/dev/null || echo "") | ||
| fi | ||
|
|
||
| if [ "$CURRENT_STORY" == "$LAST_STORY" ]; then |
There was a problem hiding this comment.
Using == for string comparison in bash. While this works in [[ ]] context, consider using = for better POSIX compatibility if the script needs to run on different shells.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: ralph.sh
Line: 204:204
Comment:
Using `==` for string comparison in bash. While this works in `[[ ]]` context, consider using `=` for better POSIX compatibility if the script needs to run on different shells.
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.
Security and quality control mechanisms.
Link to article by Sam Keen which provides great recommendations: https://alteredcraft.com/p/the-ralph-wiggum-agent-loop-is-really
See Greptile review below for features implemented.
Runs now look like this at start:
